package com.agy.filemanager.timer;

import com.agy.filemanager.springBootTimer;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * @author Zhang Fan
 * @date 2018\8\2 0002 11:00
 * @desc 定时服务
 */
@Service
public class Timer {
    protected static final Logger logger = LoggerFactory.getLogger(springBootTimer.class);
    private int count=0;
    @Scheduled(cron="0 0 0 * * ?")
    private void process(){
        System.out.println("this is scheduler task runing "+(count++));
    }
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");

//    @Scheduled(fixedRate = 6000)
//    public void reportCurrentTime() {
//        System.out.println("现在时间：" + dateFormat.format(new Date()));
//    }
}
